package com.xyf.sys.constant;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.List;
import java.util.Map;

/**
 * @Author R-H
 * @Date 2024/3/51900
 * @Description
 */
public class CommonConstant {

    public static List<String> randomAvatorList;

    public static Map<String, Map<String, String>> channelsConfigList;

    static {
        try (InputStream inputStream = CommonConstant.class.getClassLoader().getResourceAsStream("avatars.json");
             Reader reader = new InputStreamReader(inputStream)) {
            JSONObject jsonObject = JSON.parseObject(reader, JSONObject.class);
            JSONArray avatars = jsonObject.getJSONArray("avatars");
            randomAvatorList = avatars.toJavaList(String.class);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static final long ONE_MINUTE = 60000L;

    public static final long ONE_HOUR = 3600000L;

    public static final long ONE_DAY = 86400000L;

    public static final long ONE_WEEK = 604800000L;

    public static final String ONE_SECOND_AGO = "秒前";

    public static final String ONE_MINUTE_AGO = "分钟前";

    public static final String ONE_HOUR_AGO = "小时前";

    public static final String ONE_DAY_AGO = "天前";

    public static final String ONE_MONTH_AGO = "月前";

    public static final String ONE_YEAR_AGO = "年前";
}
